package javaseof10day.day2.pm;

import java.util.ArrayList;
import java.util.List;

public class loginAction {

	
	
    private static List<Users> Userslist = new ArrayList<Users>();
    
    
    
    static{
        
    	Userslist.add(new Users(1,"admin","admin"));
     	Userslist.add(new Users(1,"zhansan","zhansan"));
     	Userslist.add(new Users(1,"lisi","lisi"));

    }
    public static List<Users> getUserslist(){
        return Userslist;
    }
	
    public static boolean login(String name, String password) {

		if (name.trim() == "" || name == null) {

			return false;

		}

		if (password.trim() == "" || password == null) {

			return false;

		}

		List<Users> userlist = loginAction.getUserslist();

		for (Users users : userlist) {

			if (users.getName() == name) {

				if (users.getPassword() == password) {

					return true;

				}else {
					return false;
				}
				
				
				
				
				
			}else {
				return false;
			}

		}

		return false;
	}
	
}
